#!/bin/bash
set -e

cd $(dirname $0)/..

echo Running tests

if [ ! -x ./bin/convoy ]; then
    ./scripts/build
fi

PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} |  cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"

go test -race -cover -tags "libdm_no_deferred_remove s3test" ${PACKAGES}
